$(document).unbind("registerFormLoaded").bind("registerFormLoaded",null,function(){function B(D){$(".note-"+D).removeClass("form-note form-error form-success").addClass("form-note").css("visibility","visible").text(info[D])
}function A(E,D){$(".note-"+E).removeClass("form-note form-error form-success").addClass("form-error").html(D)
}function C(E,D){$(".note-"+E).removeClass("form-note form-error form-success").addClass("form-success").text(D)
}$("input.register-input").focus(function(){var D=$(this).attr("name").replace(/\[/g,"\\[").replace(/\]/g,"\\]");
if($(this).val().length==0){B(D)}$(".note-"+D).css("visibility","visible")});$("input.register-input").blur(function(){if($(this).val().length==0){$(".note-"+$(this).attr("name").replace(/\[/g,"\\[").replace(/\]/g,"\\]")).css("visibility","hidden")
}});$("input.nocheck").blur(function(){if($(this).val().length>0){$(".note-"+$(this).attr("name").replace(/\[/g,"\\[").replace(/\]/g,"\\]")).css("visibility","hidden")
}});$(".birthday-mm, .birthday-dd, .birthday-yyy").focus(function(){B("birthday")});$(".username").validateActive("usernameAvailable",function(D){A("username",D.error?D.error:D.message);
$("#username-recs").fadeIn()},function(D){if(D.success){C("username","Yay! The username "+D.username+" is available")
}else{A("username",D.error?D.error:D.message);$("#username-recs").fadeIn()}});$(".email").validate("emailAvailable",function(D){A("email",D.error?D.error:D.message)
},function(D){if(D.success){C("email","Your email address appears valid. This is a good thing.")}else{A("email",D.error?D.error:D.message)
}});$(".facebook-email").validate("emailAvailable",function(D){A("facebook-email",D.error?D.error:D.message)
},function(D){if(D.success){C("facebook-email","Your email address appears valid. This is a good thing.")
}else{A("facebook-email",D.error?D.error:D.message)}});$(".emailverify").blur(function(){if($(this).val()!=$("#email").val()){A($(this).attr("id"),"Email addresses do not match")
}else{$("#note-"+$(this).attr("id")).css("visibility","hidden")}});$(".password\\[a\\]").validate("password",function(D){A("password\\[a\\]",D.error?D.error:D.message)
},function(D){C("password\\[a\\]","Your password looks good. Remember to remember it.")});$(".password\\[a\\]").keyup(function(){if($(this).val().length>=6){$(".note-password\\[a\\]").css("visibility","hidden")
}});$(".password\\[b\\]").blur(function(){if($(this).val().length&&$(".password\\[a\\]").val().length){if($(this).val()!=$(".password\\[a\\]").val()){A("password\\[b\\]","Passwords do not match")
}else{C("password\\[b\\]","Passwords match! Woohoo!")}}});$(".password\\[a\\]").blur(function(){if($(this).val().length&&$(".password\\[b\\]").val().length){if($(this).val()!=$(".password\\[b\\]").val()){A("password\\[b\\]","Passwords do not match")
}else{C("password\\[b\\]","Passwords match! Woohoo!")}}});$("#invite-skip").click(function(){window.location="/register/done"
})});$(document).ready(function(){$(document).trigger("registerFormLoaded",null)});jQuery.fn.extend({validate:function(endPoint,failure,success){jQuery(this).blur(function(){if(jQuery(this).val().length==0){return false
}jQuery.ajax({type:"POST",url:"/ajax/validate/"+endPoint,dataType:"json",data:{check:jQuery(this).val(),token:tokens.validate[endPoint]},success:function(json){if(typeof (success)=="function"){success(json)
}},error:function(xml){var json=eval("("+xml.responseText+")");failure(json)}})})},validateActive:function(endPoint,failure,success){jQuery(this).keyup(function(){var _this=jQuery(this);
var timer=_this.attr("validateTimer");if(timer){clearTimeout(timer)}if(_this.val().length==0){return false
}if(_this.val().length>3){timer=setTimeout(function(){jQuery.ajax({type:"POST",url:"/ajax/validate/"+endPoint,dataType:"json",data:{check:_this.val(),token:tokens.validate[endPoint]},success:function(json){if(typeof (success)=="function"){success(json)
}},error:function(xml){var json=eval("("+xml.responseText+")");failure(json)}})},500);_this.attr("validateTimer",timer)
}})}});